import request from '../utils/request.js'


//调用登录接口
export const userLoginService = (loginData) => {
	const params=new URLSearchParams();
	for(let key in loginData){
		params.append(key,loginData[key])
	}
	return request.post('http://127.0.0.1:4523/m2/5557077-5234143-default/240402553',params)
}
//调用注册接口
export const userRegisterService = (registerData) => {
	const params=new URLSearchParams();
	for(let key in registerData){
		params.append(key,registerData[key])
	}
	return request.post('http://127.0.0.1:4523/m1/5557077-5234143-default/user/register',params)
}


// 调用查询用户信息接口
export const getUserInfoService = (UserInfoData) => {
    console.log(UserInfoData);  // 打印 UserInfoData 进行调试
    return request.get('http://127.0.0.1:4523/m1/5557077-5234143-default/user/userInfo', {
      params: UserInfoData
    });
  };
  
// 调用修改用户信息接口
export const updateUserInfoService = (UserInfoData) => {
    console.log(UserInfoData);  // 打印 UserInfoData 进行调试
    return request.put('http://127.0.0.1:4523/m1/5557077-5234143-default/user', UserInfoData)
      .then(response => {
        console.log('修改成功:', response);
        return response;
      })
      .catch(error => {
        console.error('修改失败:', error);e
        throw error;  // 抛出错误，便于捕获
      });
};
  